directives.directive('confirm', ["$rootScope", "tools", "$timeout", function ($rootScope, tools, $timeout) {
    return {
        restrict: 'AE',
        scope: {},
        replace: true,
        link: function (scope, element, attr) {
            scope.title = '';
            scope.content = '';
            scope.btns = {};

            $rootScope.$on('CONFIRM_EV', function (e, config) {
                scope.title = config.title;
                scope.content = config.content;
                scope.btns = config.btns;
                $(element).modal('show');
            });
            $rootScope.$on('CONFIRM_OFF_EV', function () {
                $(element).modal('hide');
            });
            scope.close = function () {
                $(element).modal('hide');
            }
        },
        templateUrl: "/trend-new-BI/app/components/common/confirm/confirmView.html"
    }
}]);